package com.czh.service.Role;

import com.czh.dao.BaseDao;
import com.czh.dao.Role.RoleDao;
import com.czh.dao.Role.RoleDaoImpl;
import com.czh.pojo.Role;
import org.junit.jupiter.api.Test;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class RoleServiceImpI implements RoleService{
    private RoleDao roleDao;
    public RoleServiceImpI() {
        roleDao = new RoleDaoImpl();
    }

    @Override
    public List<Role> getRoleList() throws SQLException {
        Connection con = null;
        List<Role> roleList = null;
        try {
            con = BaseDao.getConnection();
            roleList = roleDao.getRole(con);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            BaseDao.closeConnect(con,null,null);
        }
        return roleList;
    }
}
